﻿#region Using directives

using System;
using System.Collections;
using System.Data;
using UFSoft.UBF.UI.MD.Runtime;
using UFSoft.UBF.UI.MD.Runtime.Implement;

#endregion

namespace ItemRef
{
	[Serializable]
	public partial class ItemRefModel : UIModel
	{
		#region Constructor
		public ItemRefModel() : base("ItemRef")
		{
			InitClass();
			this.SetResourceInfo("99c5294a-ea84-41ad-85f6-485d6da895a9");
            try{
			    AfterInitModel();
            }catch(Exception exception){
              IUIModel model = this;
		      this.ErrorMessage.SetErrorMessage(ref model,exception);
			}
		}

		//just for Clone 
		private ItemRefModel(bool isInit) : base("ItemRef")
		{}
		protected override IUIModel CreateCloneInstance()
		{
			return new ItemRefModel(false);
		}
		#endregion
		#region member
		#region views
		private cRefView viewcRef;			
		#endregion
		
		#region links
		#endregion
		
		#region properties
		#endregion
		#endregion

		#region property
		public cRefView cRef
		{
			get { return (cRefView)this["cRef"]; }
		}
		
		#region RealViews
		#endregion
		
	
		#endregion

		#region function
		private void InitClass()
		{
			this.viewcRef = new cRefView(this);
			this.viewcRef.SetResourceInfo("c77f5985-fad8-4b86-834e-611a3222a739");
			this.Views.Add(this.viewcRef);			

			
		}

		public override string AssemblyName
		{
			get { return "UFIDA.U9.Cust.U9Demo.DeliverUI"; }
		}
		
		#endregion
		private void OnValidate_DefualtImpl()
    {
    }

	}


	[Serializable]
	public partial class cRefView : UIView
	{
		#region Constructor
		public cRefView(IUIModel model) : base(model,"cRef","UFIDA.U9.CBO.SCM.Item.ItemMaster", true)
		{
			InitClass();
		}
		//构造空实例,不进行初始化.目前为Clone使用.
		private cRefView():base(null,"cRef","UFIDA.U9.CBO.SCM.Item.ItemMaster", true)
		{
		}
		protected override IUIView CreateCloneInstance()
		{
			return new cRefView();
		}
		#endregion

		#region fiels property filter
		public IUIField FieldID
		{
			get { return this.Fields["ID"]; }
		}
		public IUIField FieldCode
		{
			get { return this.Fields["Code"]; }
		}
		public IUIField FieldName
		{
			get { return this.Fields["Name"]; }
		}
		public IUIField FieldDescription
		{
			get { return this.Fields["Description"]; }
		}
		public IUIField FieldSPECS
		{
			get { return this.Fields["SPECS"]; }
		}
		public IUIField FieldPurchaseUOM_ID
		{
			get { return this.Fields["PurchaseUOM_ID"]; }
		}
		public IUIField FieldPurchaseUOM_Code
		{
			get { return this.Fields["PurchaseUOM_Code"]; }
		}
		public IUIField FieldPurchaseUOM_Name
		{
			get { return this.Fields["PurchaseUOM_Name"]; }
		}
		public IUIField FieldPurchaseUOM_Round_Precision
		{
			get { return this.Fields["PurchaseUOM_Round_Precision"]; }
		}
		public IUIField FieldPurchaseUOM_Round_RoundType
		{
			get { return this.Fields["PurchaseUOM_Round_RoundType"]; }
		}
		public IUIField FieldPurchaseUOM_Round_RoundValue
		{
			get { return this.Fields["PurchaseUOM_Round_RoundValue"]; }
		}


		[Obsolete("请使用CurrentFilter属性，这个方法有可能会导致强弱类型转换出错")]
		public cRefDefaultFilterFilter DefaultFilter
		{
			get { return (cRefDefaultFilterFilter)this.CurrentFilter; }
		}
		#endregion

		#region Init
		private void InitClass()
		{
			UIModelRuntimeFactory.AddNewUIField(this,"ID", typeof(Int64), false,"","System.Int64", "ID", true,true, false, "",false,(UIFieldType)1,"ba391065-6c27-4c82-acc8-b52b1c93a910","bd7ffb34-2f9c-45cb-b500-16cdf97f816a");
			UIModelRuntimeFactory.AddNewUIField(this,"Code", typeof(String), false,"","System.String", "Code", true,true, false, "",false,(UIFieldType)1,"3d174255-fd12-47f7-8844-3b5e4fae9e8c","f3ef2d73-e22b-4402-a57f-ccb0c053e5dc");
			UIModelRuntimeFactory.AddNewUIField(this,"Name", typeof(String), false,"","System.String", "Name", true,true, false, "",false,(UIFieldType)1,"3d174255-fd12-47f7-8844-3b5e4fae9e8c","b343851c-3a6b-44bb-87b2-a6e9c1be639d");
			UIModelRuntimeFactory.AddNewUIField(this,"Description", typeof(String), true,"","System.String", "Description", true,true, false, "",true,(UIFieldType)1,"3d174255-fd12-47f7-8844-3b5e4fae9e8c","5109abb1-591a-4374-b873-796688141f40");
			UIModelRuntimeFactory.AddNewUIField(this,"SPECS", typeof(String), true,"","System.String", "SPECS", true,true, false, "",false,(UIFieldType)1,"3d174255-fd12-47f7-8844-3b5e4fae9e8c","a8eb4b1a-620a-4a12-8516-fd86ae58a2f3");
			UIModelRuntimeFactory.AddNewUIField(this,"PurchaseUOM_ID", typeof(Int64), false,"","System.Int64", "PurchaseUOM.ID", false,true, false, "",false,(UIFieldType)1,"ba391065-6c27-4c82-acc8-b52b1c93a910","8282235d-eab5-432f-a080-4e6f9aac4344");
			UIModelRuntimeFactory.AddNewUIField(this,"PurchaseUOM_Code", typeof(String), false,"","System.String", "PurchaseUOM.Code", false,true, false, "",false,(UIFieldType)1,"3d174255-fd12-47f7-8844-3b5e4fae9e8c","3799ef54-cfd0-4675-b14a-601f64a449b7");
			UIModelRuntimeFactory.AddNewUIField(this,"PurchaseUOM_Name", typeof(String), true,"","System.String", "PurchaseUOM.Name", false,true, false, "",true,(UIFieldType)1,"3d174255-fd12-47f7-8844-3b5e4fae9e8c","d3564c18-4c52-41fa-bed4-113f99e018b7");
			UIModelRuntimeFactory.AddNewUIField(this,"PurchaseUOM_Round_Precision", typeof(Int32), false,"","System.Int32", "PurchaseUOM.Round.Precision", false,true, false, "",false,(UIFieldType)1,"d7c6031e-d3fe-41aa-a397-5edd86c10cae","b0e955e6-c235-4a46-9e97-fc0b8d68d872");
			UIModelRuntimeFactory.AddNewUIField(this,"PurchaseUOM_Round_RoundType", typeof(Int32), false,"","UFIDA.U9.Base.PropertyTypes.RoundTypeEnum", "PurchaseUOM.Round.RoundType", false,true, false, "",false,(UIFieldType)2,"fbf427db-9665-4dce-a024-11de74c9beae","03e6a848-a4af-466f-bff1-7381dcd3d78b");
			UIModelRuntimeFactory.AddNewUIField(this,"PurchaseUOM_Round_RoundValue", typeof(Int32), true,"","System.Int32", "PurchaseUOM.Round.RoundValue", false,true, false, "",false,(UIFieldType)1,"d7c6031e-d3fe-41aa-a397-5edd86c10cae","a66c26bb-b2bc-4d86-bb91-f4bd76e14fb2");


			this.CurrentFilter = new cRefDefaultFilterFilter(this);
		}
		#endregion
		
		#region override method
		protected override IUIRecord BuildNewRecord(IUIRecordBuilder builder)
		{
			return new cRefRecord(builder);
		}
		#endregion

		#region new method
		public new cRefRecord FocusedRecord
		{
			get { return (cRefRecord)base.FocusedRecord ; }
			set { base.FocusedRecord = value ; }
		}
		public new cRefRecord AddNewUIRecord()
		{	
			return (cRefRecord)base.AddNewUIRecord();
		}
		public new cRefRecord NewUIRecord()
		{	
			return (cRefRecord)base.NewUIRecord();
		}
		#endregion 

	}

	[Serializable]
	public class cRefRecord : UIRecord
	{
		#region Constructor
		public cRefRecord(IUIRecordBuilder builder):base(builder)
		{
		}
		private cRefView uiviewcRef
		{
			get { return (cRefView)this.ContainerView; }
		}
		protected override IUIRecord CreateCloneInstance(IUIRecordBuilder builder)
		{
			return new cRefRecord(builder);
		}
		#endregion

		#region property
		
		
		public  Int64 ID
		{
			get{
				//object value = this[this.uiviewcRef.FieldID] ;
				//return (Int64)value;
				return GetValue<Int64>(this.uiviewcRef.FieldID);
			}
			set{
				this[this.uiviewcRef.FieldID] = value;
			}
		}
		
		
		public  String Code
		{
			get{
				//object value = this[this.uiviewcRef.FieldCode] ;
				//return (String)value;
				return GetValue<String>(this.uiviewcRef.FieldCode);
			}
			set{
				this[this.uiviewcRef.FieldCode] = value;
			}
		}
		
		
		public new String Name
		{
			get{
				//object value = this[this.uiviewcRef.FieldName] ;
				//return (String)value;
				return GetValue<String>(this.uiviewcRef.FieldName);
			}
			set{
				this[this.uiviewcRef.FieldName] = value;
			}
		}
		
		
		public  String Description
		{
			get{
				//object value = this[this.uiviewcRef.FieldDescription] ;
				//return (String)value;
				return GetValue<String>(this.uiviewcRef.FieldDescription);
			}
			set{
				this[this.uiviewcRef.FieldDescription] = value;
			}
		}
		
		
		public  String SPECS
		{
			get{
				//object value = this[this.uiviewcRef.FieldSPECS] ;
				//return (String)value;
				return GetValue<String>(this.uiviewcRef.FieldSPECS);
			}
			set{
				this[this.uiviewcRef.FieldSPECS] = value;
			}
		}
		
		
		public  Int64 PurchaseUOM_ID
		{
			get{
				//object value = this[this.uiviewcRef.FieldPurchaseUOM_ID] ;
				//return (Int64)value;
				return GetValue<Int64>(this.uiviewcRef.FieldPurchaseUOM_ID);
			}
			set{
				this[this.uiviewcRef.FieldPurchaseUOM_ID] = value;
			}
		}
		
		
		public  String PurchaseUOM_Code
		{
			get{
				//object value = this[this.uiviewcRef.FieldPurchaseUOM_Code] ;
				//return (String)value;
				return GetValue<String>(this.uiviewcRef.FieldPurchaseUOM_Code);
			}
			set{
				this[this.uiviewcRef.FieldPurchaseUOM_Code] = value;
			}
		}
		
		
		public  String PurchaseUOM_Name
		{
			get{
				//object value = this[this.uiviewcRef.FieldPurchaseUOM_Name] ;
				//return (String)value;
				return GetValue<String>(this.uiviewcRef.FieldPurchaseUOM_Name);
			}
			set{
				this[this.uiviewcRef.FieldPurchaseUOM_Name] = value;
			}
		}
		
		
		public  Int32 PurchaseUOM_Round_Precision
		{
			get{
				//object value = this[this.uiviewcRef.FieldPurchaseUOM_Round_Precision] ;
				//return (Int32)value;
				return GetValue<Int32>(this.uiviewcRef.FieldPurchaseUOM_Round_Precision);
			}
			set{
				this[this.uiviewcRef.FieldPurchaseUOM_Round_Precision] = value;
			}
		}
		
		
		public  Int32 PurchaseUOM_Round_RoundType
		{
			get{
				//object value = this[this.uiviewcRef.FieldPurchaseUOM_Round_RoundType] ;
				//return (Int32)value;
				return GetValue<Int32>(this.uiviewcRef.FieldPurchaseUOM_Round_RoundType);
			}
			set{
				this[this.uiviewcRef.FieldPurchaseUOM_Round_RoundType] = value;
			}
		}
		
		
		public  Int32? PurchaseUOM_Round_RoundValue
		{
			get{
				//object value = this[this.uiviewcRef.FieldPurchaseUOM_Round_RoundValue] ;
				//return (Int32?)value;
				return GetValue<Int32?>(this.uiviewcRef.FieldPurchaseUOM_Round_RoundValue);
			}
			set{
				this[this.uiviewcRef.FieldPurchaseUOM_Round_RoundValue] = value;
			}
		}
		#endregion
	}
	
	[Serializable]
	public class cRefDefaultFilterFilter : UIFilter
	{
		#region Constructor
		public cRefDefaultFilterFilter(IUIView view) 
			: base("DefaultFilter",view,@"Org.ID=#Context.OrgID# and Effective.IsEffective=1 and Effective.EffectiveDate<='#Context.DateTime#' and Effective.DisableDate>='#Context.DateTime#'",@"")
		{
			InitClass();
		}
		//for Clone Constructor
		private cRefDefaultFilterFilter()
			: base("DefaultFilter",null,"","")
		{}
		protected override IUIFilter CreateCloneInstance()
		{
			return new cRefDefaultFilterFilter();
		}
		#endregion

		#region property
		#endregion
		
		#region function
		private void InitClass()
		{
		}
		#endregion

	}



}